package com.hnevc.xiewenguang;

import java.io.*;

/**
 *
 * 使用IO流对文件进行拷贝操作
 *
 */
public class Example02 {

    private static InputStream inputStream;
    private static OutputStream outputStream;

    public static void main(String[] args) throws IOException {
        try{
            //读
            inputStream = new FileInputStream("banama.png");
            //写
            outputStream = new FileOutputStream("src\\banama.png");
            int len;
            while ((len = inputStream.read()) != -1){ //读取内容。判断是否已经完成读取
                  outputStream.write(len); // 写入内容
        }
    } catch (Exception e){
            e.printStackTrace();
        }finally {
            inputStream.close();
            outputStream.close();
        }
        }
}

